﻿$(document).ready(function(){
  $("#del_product").click(function(){
    if (!confirm("确认删除选定商品？"))
    {
      return;
    }
    $("#MainContent input:checked").each(function(){
      var id = $(this).val();
      query = "Code_id=" + id; 
      $.ajax({ 
				async: false,
        type: "get", 
        url: "Aspsrc/del_Item.asp", 
        data: query,
        dataType: "xml",
        error: function(request, msg, obj){ alert("错误的请求" + obj + request.responseText);},
        beforeSend: function(){}, 
        success: function(xmlDoc){ 
        s = getNodeValue(xmlDoc, "status");
          if(s == "success")
          {
            return true;
          }
          else
          {
					  errorMsg = getNodeValue(xmlDoc, "errorMsg");
            alert(errorMsg);
            return false;
          }
        }
      });
   });
   window.location.reload();
 });
 $("#MainContent input:checked").each(function(){
   $(this).attr("checked", false);
 });
});


// 获取 XML 信息
function getNodeValue(xmlDoc, nodeName)
{
  return $(xmlDoc).find(nodeName).text();
}
